using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

public partial class PregledNaPolinja : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/Proekt.mdb;"; //postavuvame "adresa" do bazata
        OleDbConnection conn = new OleDbConnection(conString);

        conn.Open();

        string select = "SELECT * FROM POLINJA WHERE ID = ?";
        OleDbCommand select_pole = new OleDbCommand(select, conn);
        select_pole.Parameters.AddWithValue("?", ListBox1.SelectedValue);
        OleDbDataReader reader = select_pole.ExecuteReader();

        reader.Read();
        Label5.Text = reader["IME"].ToString();
        Label7.Text = reader["BOJA"].ToString();
        Label9.Text = reader["KUKI"].ToString();
        Label11.Text = reader["HOTEL"].ToString();
        object temp = reader["IGRACID"];
        if (temp.ToString().Equals(""))
        {
            Label13.Text = "Nema sopstvenik!";
        }
        else
        {
            string select2 = "SELECT IME FROM IGRACI WHERE ID = ?";
            OleDbCommand select_igrac = new OleDbCommand(select2, conn);
            select_igrac.Parameters.AddWithValue("?", temp.ToString());
            OleDbDataReader reader2 = select_igrac.ExecuteReader();

            reader2.Read();
            Label13.Text = reader2["IME"].ToString();
        }


        conn.Close();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("Admin.aspx");
    }
}
